{% extends "repo_master.html" %}
{% from "_formhelper.html" import render_bootstrap_field %}

{% block title %}Remote Pull request {{
    repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
{% set tag = "home" %}

{% block repo %}


<h2>New remote pull-request</h2>

<p>
  *Remote pull-requests* are pull-requests from projects hosted somewhere
  else than this Pagure instance.
</p>

<p>
  If you would like to submit a new remote pull-request to this project,
  please provide the URL for the remote Git repository and the branch you
  want to merge.
</p>

<p>
  If you wish to create a pull-request from a fork to a project on pagure,
  visit your fork, go to the branch where you pushed your changes, it will
  show the commits that can be merged with a red asterisk and click on the
  "Pull-Request" button.
</p>

{% if form %}
  <form action="{{ url_for(
    '.new_remote_request_pull',
    repo=repo.name,
    username=username,
    namespace=repo.namespace) }}" method="post">
    <div class="card-block">
      {{ render_bootstrap_field(
          form.title, size=80,
          field_description="title of the pull-request") }}
      {{ render_bootstrap_field(
          form.git_repo, size=80,
          field_description="public url to the git repository containing the changes to merge") }}
      {{ render_bootstrap_field(form.branch_from, size=80) }}
      To branch:
      <select id="branch_select" name="branch_to" class="c-select">
        {% if branch_to %}<option>{{ branch_to }}</option>{% endif %}
        {% for branch in g.branches |reverse %}
          {% if not branch_to or branch != branch_to %}
          <option>{{ branch }}</option>
          {% endif %}
        {% endfor %}
      </select>

    </div>
    <p class="buttons indent">
      <input type="submit" class="btn btn-primary" value="Preview">
      {{ form.csrf_token }}

      <a href="{{ url_for(
        'view_repo',
        repo=repo.name,
        username=username,
        namespace=repo.namespace)}}">
        <input type="button" class="btn btn-secondary" value="Cancel" />
      </a>
    </p>
  </form>
{% endif %}

{% endblock %}

